//
//  HDProfileLoginTableViewCell.swift
//  Excited
//
//  Created by X140Yu on 6/18/16.
//  Copyright © 2016 X140Yu. All rights reserved.
//

import UIKit

class HDProfileLoginTableViewCell: UITableViewCell {

    // 0
    @IBOutlet weak var avatarImageView: UIImageView!
    @IBOutlet weak var usernameLabel: UILabel!
    @IBOutlet weak var studentIDLabel: UILabel!
    
    // 1
    @IBOutlet weak var personalInfoContentView: UIView!
    @IBOutlet weak var gradeLabel: UILabel!
    @IBOutlet weak var collegeLabel: UILabel!
    @IBOutlet weak var specialityLabel: UILabel!
    
    // 2
    @IBOutlet weak var pointsContentView: UIView!
    @IBOutlet weak var alreadFinishedCreditLabel: UILabel!
    @IBOutlet weak var performancePointLabel: UILabel!
    @IBOutlet weak var diedPointsLabel: UILabel!
    
    internal func setUserInfo() {
        if let pyfa = HDCache.sharedInstance.getPYFA() {
            gradeLabel.text = "年级  \(pyfa.attendYear) 级"
            collegeLabel.text = "学院  \(pyfa.academy)"
            specialityLabel.text = "专业 \(pyfa.major)"
        }

        if let realName = HDCache.sharedInstance.getReadName() {
            usernameLabel.text = "姓名：\(realName)"
        }

        if let user = HDCache.sharedInstance.currentLoginUser() {
            studentIDLabel.text = "学号：\(user.username)"
        }
    }
   
    internal func setCreditInfo() {
//        if let credit = HDCache.getCredit() {
//            alreadFinishedCreditLabel.text = credit.passCredit!
//            performancePointLabel.text = credit.gpa!
//            diedPointsLabel.text = credit.failedCredit!
//        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        alreadFinishedCreditLabel.text = ""
        performancePointLabel.text = ""
        diedPointsLabel.text = ""

        personalInfoContentView.layer.shadowOffset = CGSize(width: 0, height: 0)
        personalInfoContentView.layer.shadowOpacity = 0.7
        personalInfoContentView.layer.shadowRadius = 2
        
        pointsContentView.layer.shadowOffset = CGSize(width: 0, height: 0)
        pointsContentView.layer.shadowOpacity = 0.7
        pointsContentView.layer.shadowRadius = 2
    }

    override func setSelected(selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
